from django.db import models


# Create your models here.


class CateModel(models.Model):

    name = models.CharField(max_length=30)

    class Meta:
        db_table = 'cate'

    def __str__(self):
        return self.name


class GoodsModel(models.Model):
    title = models.CharField(max_length=200)
    price = models.DecimalField(max_digits=10, decimal_places=2)
    img = models.CharField(max_length=200)
    cate = models.ForeignKey(CateModel,on_delete=models.CASCADE)

    class Meta:
        db_table = 'goods'

    def __str__(self):
        return self.title
